local transform = function(self,offsetFromCenter,itemIndex,numitems)
	self:y( offsetFromCenter * 23 );
	if offsetFromCenter < 0 or offsetFromCenter > 5 then
		self:linear(0.5):diffusealpha(0)
	else
		self:linear(0.5):diffusealpha(1)
	end
end
return Def.CourseContentsList {
	MaxSongs = 10;
    NumItemsToDraw = 8;
	ShowCommand=cmd(linear,0.3;diffusealpha,1);
	HideCommand=cmd(linear,0.3;diffusealpha,0);
	SetCommand=function(self)
		self:SetFromGameState();
		self:SetCurrentAndDestinationItem(0);
		self:SetPauseCountdownSeconds(1);
		self:SetSecondsPauseBetweenItems( 0.5 );
		self:SetTransformFromFunction(transform);
		
		self:SetDestinationItem( math.max(0,self:GetNumItems() - 4) );
		self:SetLoop(false);
		self:SetMask(0,0);
	end;
	CurrentTrailP1ChangedMessageCommand=cmd(playcommand,"Set");
	CurrentTrailP2ChangedMessageCommand=cmd(playcommand,"Set");

	Display = Def.ActorFrame { 
		InitCommand=function(self) self:setsize(270,44):diffusealpha(0):queuecommand("Appear") end;
		AppearCommand=function(self) self:sleep(2):linear(0.4):diffusealpha(1) end;

		LoadActor(THEME:GetPathG("CourseEntryDisplay","bar")) .. {
-- 			InitCommand=cmd(diffusetopedge,Color("Invisible"));
			SetSongCommand=function(self, params)
				if params.Difficulty then
-- 					self:diffuse( SONGMAN:GetSongColor(params.Song) );
					self:diffuse( CustomDifficultyToColor(params.Difficulty) );
				else
					self:diffuse( color("#FFFFFF") );
-- 					self:diffuse( CustomDifficultyToColor(params.Difficulty) );
				end

				(cmd(finishtweening;diffusealpha,0;sleep,0.125*params.Number;linear,0.125;diffusealpha,1;linear,0.05;glow,color("1,1,1,0.5");decelerate,0.1;glow,color("1,1,1,0")))(self);
			end;
		};

		Def.TextBanner { -- Song list in current course
			InitCommand=cmd(x,-128;y,-50;zoom,0.8;Load,"TextBannerCourse";SetFromString,"", "", "", "", "", "");
			SetSongCommand=function(self, params)
				if params.Song then
					if GAMESTATE:GetCurrentCourse():GetDisplayFullTitle() == "Abomination" then
						-- abomination hack
						if PREFSMAN:GetPreference("EasterEggs") then
							if params.Number % 2 ~= 0 then
								-- turkey march
								local artist = params.Song:GetDisplayArtist();
								self:SetFromString( "Turkey", "", "", "", artist, "" );
							else
								self:SetFromSong( params.Song );
							end;
						else
							self:SetFromSong( params.Song );
						end;
					else
						self:SetFromSong( params.Song );
					end;
					self:diffuse( CustomDifficultyToLightColor(params.Difficulty) );
					self:glow(1,1,1,0.5);
				else
					self:SetFromString( "??????????", "??????????", "", "", "", "" );
					self:diffuse( color("#FFFFFF") );
					self:glow(1,1,1,0);
				end
			
				(cmd(finishtweening;diffusealpha,0;sleep,0.2;linear,0.2*params.Number;diffusealpha,1;))(self);
			end;
		};

 		LoadFont("_g7 star force ttf 20px") .. { -- Difficulties in current course
			Text="0";
			InitCommand=cmd(x,180;y,-58;zoom,0.75;shadowlength,1);
			SetSongCommand=function(self, params)
				if params.PlayerNumber ~= GAMESTATE:GetMasterPlayerNumber() then return end
				self:settext( params.Meter );
				self:diffuse( CustomDifficultyToColor(params.Difficulty) );
				(cmd(finishtweening;diffusealpha,0;sleep,0.2;linear,0.2*params.Number;diffusealpha,1;))(self);
				if params.Meter >= "16" then
					self:textglowmode('TextGlowMode_Inner'):glowshift()
				else
					self:stopeffect()
				end
			end;
		}; 

	};
};